Skip to content

Conversation

@RafaelKayumov
Copy link
Contributor

WOOMOB-1835

Description

This is a rollback of #16350 for the 23.7 release.

In last minute before 23.7 rollout we discovered a crash that was happening for our results controllers. The first thing that came to my mind was a tweak to actualize the fetched object collection after a predicate / sorting change: Results controller: Notify listeners of changes when updating predicate and sort descriptors That's exactly the place where we touched the ResultsController behaviour. So let's revert it and revisit as a new task.

Check out the WOOMOB-1835 for crash log reference.

NSInternalInconsistencyException: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (10) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). Table view: <UITableView: 0x11a2eea00; frame = (0 165; 393 604); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x1241f6370>; backgroundColor = <UIDynamicProviderColor: 0x1135c6080; provider = <__NSMallocBlock__: 0x112e76fd0>>; layer = <CALayer: 0x1241f5710>; contentOffset: {0, 0}; contentSize: {393, 45}; adjustedContentInset: {0, 0, 208, 0}; dataSource: <_TtGC11WooCommerce20SearchViewControllerCS_31ProductsTabProductTableViewCellCS_22ProductSearchUICommand_: 0x11a140f00>>
  CoreFoundation      0x198c26964  __exceptionPreprocess
  libobjc.A           0x195b35810  objc_exception_throw
  Foundation          0x196ad2b04  -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
  UIKitCore           0x19faff614  -[UITableView _Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Rows_In_Section:]
  UIKitCore           0x19fafedc0  -[UITableView _endCellAnimationsWithContext:]
  UIKitCore           0x19fb11624  -[UITableView _updateRowsAtIndexPaths:withUpdateAction:rowAnimation:usingPresentationValues:]
  UIKitCore           0x19fb1171c  -[UITableView insertRowsAtIndexPaths:withRowAnimation:]
  WooCommerce         0x1050769b8  closure in ResultsController.startForwardingObjectEvents (ResultsController+UIKit.swift:100)
  WooCommerce         0x10507716c  closure in ResultsController.startForwardingObjectEvents (<compiler-generated>)
  WooCommerce         0x10609676c  closure in GenericResultsController.setupEventsForwarding (ResultsController.swift:271)
  WooCommerce         0x1060526d4  FetchedResultsControllerDelegateWrapper.controller (FetchedResultsControllerDelegateWrapper.swift:45)
  WooCommerce         0x1060526d4  FetchedResultsControllerDelegateWrapper.controller (<compiler-generated>:40)
  CoreData            0x19b280574  __82-[NSFetchedResultsController _core_managedObjectContextDidChange:]_block_invoke
  CoreData            0x19b0f3a48  developerSubmittedBlockToNSManagedObjectContextPerform
  CoreData            0x19b21d418  -[NSManagedObjectContext performBlockAndWait:]
  CoreData            0x19b27ef10  -[NSFetchedResultsController _core_managedObjectContextDidChange:]
  CoreFoundation      0x198bb185c  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
  CoreFoundation      0x198bb190c  ___CFXRegistrationPost_block_invoke
  CoreFoundation      0x198bb1768  _CFXRegistrationPost
  CoreFoundation      0x198bb1f08  _CFXNotificationPost
  Foundation          0x196b2f2e8  -[NSNotificationCenter postNotificationName:object:userInfo:]
  CoreData            0x19b223014  -[NSManagedObjectContext _createAndPostChangeNotification:deletions:updates:refreshes:deferrals:wasMerge:]
  CoreData            0x19b2130a4  -[NSManagedObjectContext _processRecentChanges:]
  CoreData            0x19b21ce68  -[NSManagedObjectContext _coreMergeChangesFromDidSaveDictionary:usingObjectIDs:withClientQueryGeneration:]
  CoreData            0x19b21d0e0  -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:]
  CoreData            0x19b0f3a48  developerSubmittedBlockToNSManagedObjectContextPerform
  libdispatch         0x1d16957f8  _dispatch_client_callout
  libdispatch         0x1d16b2b0c  _dispatch_main_queue_drain.cold.5
  libdispatch         0x1d168aec4  _dispatch_main_queue_drain
  libdispatch         0x1d168ae00  _dispatch_main_queue_callback_4CF
  CoreFoundation      0x198bcb2b0  __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
  CoreFoundation      0x198b7eb38  __CFRunLoopRun
  CoreFoundation      0x198b7da68  _CFRunLoopRunSpecificWithOptions
  GraphicsServices    0x23a77c494  GSEventRunModal
  UIKitCore           0x19e557710  -[UIApplication _run]
  UIKitCore           0x19e4fff74  UIApplicationMain
  WooCommerce         0x1049080e8  main (main.swift:7)
  0x195b8ae28  <redacted>

  CoreFoundation      0x198c26964  __exceptionPreprocess
  libobjc.A           0x195b35810  objc_exception_throw
  Foundation          0x196ad2b04  -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:]
  UIKitCore           0x19faff614  -[UITableView _Bug_Detected_In_Client_Of_UITableView_Invalid_Number_Of_Rows_In_Section:]
  UIKitCore           0x19fafedc0  -[UITableView _endCellAnimationsWithContext:]
  UIKitCore           0x19fb11624  -[UITableView _updateRowsAtIndexPaths:withUpdateAction:rowAnimation:usingPresentationValues:]
  UIKitCore           0x19fb1171c  -[UITableView insertRowsAtIndexPaths:withRowAnimation:]
  WooCommerce         0x1050769b8  closure in ResultsController.startForwardingObjectEvents (ResultsController+UIKit.swift:100)
  WooCommerce         0x10507716c  closure in ResultsController.startForwardingObjectEvents (<compiler-generated>)
  WooCommerce         0x10609676c  closure in GenericResultsController.setupEventsForwarding (ResultsController.swift:271)
  WooCommerce         0x1060526d4  FetchedResultsControllerDelegateWrapper.controller (FetchedResultsControllerDelegateWrapper.swift:45)
  WooCommerce         0x1060526d4  FetchedResultsControllerDelegateWrapper.controller (<compiler-generated>:40)
  CoreData            0x19b280574  __82-[NSFetchedResultsController _core_managedObjectContextDidChange:]_block_invoke
  CoreData            0x19b0f3a48  developerSubmittedBlockToNSManagedObjectContextPerform
  CoreData            0x19b21d418  -[NSManagedObjectContext performBlockAndWait:]
  CoreData            0x19b27ef10  -[NSFetchedResultsController _core_managedObjectContextDidChange:]
  CoreFoundation      0x198bb185c  __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__
  CoreFoundation      0x198bb190c  ___CFXRegistrationPost_block_invoke
  CoreFoundation      0x198bb1768  _CFXRegistrationPost
  CoreFoundation      0x198bb1f08  _CFXNotificationPost
  Foundation          0x196b2f2e8  -[NSNotificationCenter postNotificationName:object:userInfo:]
  CoreData            0x19b223014  -[NSManagedObjectContext _createAndPostChangeNotification:deletions:updates:refreshes:deferrals:wasMerge:]
  CoreData            0x19b2130a4  -[NSManagedObjectContext _processRecentChanges:]
  CoreData            0x19b21ce68  -[NSManagedObjectContext _coreMergeChangesFromDidSaveDictionary:usingObjectIDs:withClientQueryGeneration:]
  CoreData            0x19b21d0e0  -[NSManagedObjectContext mergeChangesFromContextDidSaveNotification:]
  CoreData            0x19b0f3a48  developerSubmittedBlockToNSManagedObjectContextPerform
  libdispatch         0x1d16957f8  _dispatch_client_callout
  libdispatch         0x1d16b2b0c  _dispatch_main_queue_drain.cold.5
  libdispatch         0x1d168aec4  _dispatch_main_queue_drain
  libdispatch         0x1d168ae00  _dispatch_main_queue_callback_4CF
  CoreFoundation      0x198bcb2b0  __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
  CoreFoundation      0x198b7eb38  __CFRunLoopRun
  CoreFoundation      0x198b7da68  _CFRunLoopRunSpecificWithOptions
  GraphicsServices    0x23a77c494  GSEventRunModal
  UIKitCore           0x19e557710  -[UIApplication _run]
  UIKitCore           0x19e4fff74  UIApplicationMain
  WooCommerce         0x1049080e8  main (main.swift:7)
  0x195b8ae28  <redacted>

Test Steps

N/A - Wasn't ever able to reproduce on my side.


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@RafaelKayumov RafaelKayumov added this to the 23.7 milestone Dec 2, 2025
@RafaelKayumov RafaelKayumov added the type: crash The worst kind of bug. label Dec 2, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ This PR is assigned to the milestone 23.7. The due date for this milestone has already passed.
Please assign it to a milestone with a later deadline or check whether the release for this milestone has already been finished.
1 Message
📖 This PR contains changes to RELEASE-NOTES.txt.
Note that these changes won't affect the final version of the release notes as this version is in code freeze.
Please, get in touch with a release manager if you want to update the final release notes.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr16425-b4c9f1f
Version23.7
Bundle IDcom.automattic.alpha.woocommerce
Commitb4c9f1f
Installation URL1l2l6mavt3eho
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: crash The worst kind of bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants